package top.houry.im.ui.init;

import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.image.Image;
import javafx.scene.paint.Color;
import javafx.stage.StageStyle;
import top.houry.im.ui.abstracts.ImUiStageAbstract;
import top.houry.im.ui.interfaces.ImUiMainEvent;

import java.io.IOException;
import java.util.Objects;


public abstract class ImUiMainInit extends ImUiStageAbstract {

    private static final String RESOURCE_NAME = "/fxml/main/main.fxml";

    public TextArea txtInput;

    public ImUiMainInit() {
        try {
            root = FXMLLoader.load(Objects.requireNonNull(getClass().getResource(RESOURCE_NAME)));
            Scene scene = new Scene(root);
            setTitle("IM即时通信");
            scene.setFill(Color.TRANSPARENT);
            setScene(scene);
            initStyle(StageStyle.UNDECORATED);
            setResizable(true);
            this.getIcons().add(new Image("/fxml/main/img/head/logo.png"));
            obtain();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }


    private void obtain() {
        // 可以预加载
        txtInput = lookup("txt_input", TextArea.class);
    }

    public Parent root() {
        return super.root;
    }

}
